# Top Makefile for c program
CC 			:= $(CROSS_COMPILE)gcc
GG			:= $(CROSS_COMPILE)g++

# -Wall 打开所有警告
# Werror 把所有警告当作错误处理

CFLAGS 		+= -g -Wall -Werror -O2
LDFLAGS	 	+= ./../libs/testA.a 	./../libs/testB.a 

INC		 	:= -I ../main/inc 
INC		 	+= -I ../testA/inc 
INC		 	+= -I ../testB/inc  

$(warning $(INC))

SRCS_FIELS 	= $(wildcard src/*.cpp)
SRC_OBJS	= $(patsubst %.cpp, %.o, $(SRCS_FIELS))
SRC_BIN		= target_bin

all:$(SRC_BIN)

$(SRC_BIN) : $(SRC_OBJS)
	$(CC) -o $@ $^ $(INC) $(LDFLAGS)

$(SRC_OBJS): %.o : %.cpp
	$(GG) $(CFLAGS) -c $< -o $@  $(INC)

clean:
	$(RM) $(SRC_OBJS) $(SRC_BIN)